home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / scanlib / create_scan_windows.c next >
Encoding:
C/C++ Source or Header  |  1989-12-07  |  5.2 KB  |  162 lines

  1. /*
  2. ### create a scanunov window ###
  3. */
  4.  
  5. #include <suntool/sunview.h>
  6. #include <suntool/panel.h>
  7.  
  8. void create_scan_windows()
  9. {
  10.     void scan_quit_proc(),scan_go_proc(),scan_clear_proc(),scan_get_proc(),scan_show_proc();
  11.     void scan_list_type_proc(),scan_algorithm_option_proc();
  12.     int i,ipanel_row=0,px,py;
  13.     extern Frame frame,scan_frame;
  14.     extern Panel scan_panel;
  15.     extern Pixfont *boldfont;
  16.     extern Panel_item scan_quit_item,scan_get_item,scan_go_item,scan_clear_item,scan_show_item;
  17.     extern Panel_item scan_list_type_item,scan_algorithm_option_item,scan_n_stored_item;
  18.     extern Panel_item scan_xgrid_item[];
  19.     extern Panel_item scan_xmin_item[],scan_xmax_item[];
  20.     extern short scan_panel_show;
  21.     extern int panel_colormap_on;
  22.     extern int scan_list_type,scan_grid_dim,scan_algorithm_option;
  23.     extern int scan_mdim,scan_n_stored,scan_n_max;
  24.     extern int scan_xgrid[];
  25.     extern double scan_xmin[],scan_xmax[];
  26.     extern char string[],string2[];
  27.     
  28.     /* Turn on the flag */    
  29.     if(scan_panel_show){
  30.         window_set(scan_frame,WIN_SHOW,TRUE,0);    
  31.         return;
  32.     }
  33.     else
  34.         scan_panel_show = 1;
  35.  
  36.     px = (int) window_get(frame,WIN_X) + (int) window_get(frame,WIN_WIDTH)/2;
  37.     py = (int) window_get(frame,WIN_Y) + (int) window_get(frame,WIN_HEIGHT) /2;
  38.     /* Create tser frame */
  39.     scan_frame = window_create(frame,FRAME,
  40.         FRAME_NO_CONFIRM,       TRUE,
  41.         FRAME_LABEL,    "scan",
  42.         FRAME_SHOW_LABEL,       TRUE,
  43.         WIN_SHOW,       TRUE,
  44.         WIN_X,  px,
  45.         WIN_Y,  py,
  46.         WIN_FONT, boldfont,
  47.         0);
  48.     if(scan_frame == NULL) {
  49.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  50.         scan_panel_show = 0;
  51.         return;
  52.     }
  53.     /* Create Panel */
  54.     scan_panel = window_create(scan_frame, PANEL,
  55.         WIN_X, 0,
  56.         WIN_Y, 0,
  57.         WIN_FONT, boldfont,
  58.         0);
  59.     if(scan_panel == NULL) {
  60.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  61.         (void) destroy_scan_windows();
  62.         return;
  63.     }
  64.     /* Create panel items */
  65.     scan_quit_item= panel_create_item(scan_panel, PANEL_BUTTON,
  66.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  67.         PANEL_LABEL_X, ATTR_COL(0),
  68.         PANEL_LABEL_IMAGE, panel_button_image(scan_panel, "Quit", 5, boldfont),
  69.         PANEL_NOTIFY_PROC, scan_quit_proc,
  70.         0);
  71.     scan_get_item= panel_create_item(scan_panel, PANEL_BUTTON,
  72.         PANEL_LABEL_IMAGE, panel_button_image(scan_panel, "Get", 5, boldfont),
  73.         PANEL_NOTIFY_PROC, scan_get_proc,
  74.         0);
  75.     scan_go_item= panel_create_item(scan_panel, PANEL_BUTTON,
  76.         PANEL_LABEL_IMAGE, panel_button_image(scan_panel, "Go", 5, boldfont),
  77.         PANEL_NOTIFY_PROC, scan_go_proc,
  78.         0);
  79.         scan_clear_item= panel_create_item(scan_panel,PANEL_BUTTON,
  80.                 PANEL_LABEL_IMAGE,panel_button_image(scan_panel,"Clear",0,boldfont),
  81.                 PANEL_NOTIFY_PROC,scan_clear_proc,
  82.                 0);
  83.         scan_show_item= panel_create_item(scan_panel,PANEL_BUTTON,
  84.                 PANEL_LABEL_IMAGE,panel_button_image(scan_panel,"Show-Hide",0,boldfont),
  85.                 PANEL_NOTIFY_PROC, scan_show_proc,
  86.                 0);
  87.  
  88.     scan_list_type_item= panel_create_item(scan_panel, PANEL_CYCLE,
  89.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  90.         PANEL_LABEL_X, ATTR_COL(0),
  91.         PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  92.         PANEL_LABEL_STRING, "Scan List Type: ",
  93.         PANEL_CHOICE_STRINGS,
  94.             "A Point",
  95.             "Line",
  96.             "Rectagular Grid",
  97.             "3-d Cube",
  98.             "Tabulated list",
  99.             0,
  100.         PANEL_VALUE, scan_list_type,
  101.         PANEL_NOTIFY_PROC, scan_list_type_proc,
  102.         0);
  103.     scan_algorithm_option_item= panel_create_item(scan_panel, PANEL_CYCLE,
  104.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  105.         PANEL_LABEL_X, ATTR_COL(0),
  106.         PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  107.         PANEL_LABEL_STRING, "Algorithm: ",
  108.         PANEL_CHOICE_STRINGS,
  109.             "Fft",
  110.             "Lyapunov",
  111.             "Dimension",
  112.             "Auto Correlation",
  113.             0,
  114.         PANEL_VALUE, scan_algorithm_option,
  115.         PANEL_NOTIFY_PROC, scan_algorithm_option_proc,
  116.         0);
  117.         
  118.         sprintf(string,"%d",scan_n_stored);
  119.         scan_n_stored_item= panel_create_item(scan_panel,PANEL_TEXT,
  120.                 PANEL_LABEL_Y,  ATTR_ROW(ipanel_row++),
  121.                 PANEL_LABEL_X,  ATTR_COL(0),
  122.                 PANEL_VALUE,    string,
  123.                 PANEL_VALUE_DISPLAY_LENGTH, 8,
  124.                 PANEL_LABEL_STRING, "# scanned pt:",
  125.                 0);
  126.     for(i=0;i<scan_grid_dim;i++){
  127.             sprintf(string,"%d",scan_xgrid);
  128.             sprintf(string2,"# grid [%d]:",i);
  129.             scan_xgrid_item[i]= panel_create_item(scan_panel,PANEL_TEXT,
  130.                     PANEL_LABEL_Y,  ATTR_ROW(ipanel_row++),
  131.                     PANEL_LABEL_X,  ATTR_COL(0),
  132.                     PANEL_VALUE,    string,
  133.                     PANEL_VALUE_DISPLAY_LENGTH, 8,
  134.                     PANEL_LABEL_STRING, string2,
  135.                     0);
  136.     }
  137.     for(i=0;i<scan_grid_dim;i++){
  138.         sprintf(string,"%.11lg",scan_xmin[i]);
  139.         sprintf(string2,"min [%d]:",i);
  140.         scan_xmin_item[i]= panel_create_item(scan_panel,PANEL_TEXT,
  141.             PANEL_LABEL_Y,  ATTR_ROW(ipanel_row++),
  142.             PANEL_LABEL_X,  ATTR_COL(0),
  143.             PANEL_VALUE,    string,
  144.             PANEL_VALUE_DISPLAY_LENGTH, 14,
  145.             PANEL_LABEL_STRING, string2,
  146.             0);
  147.         sprintf(string,"%.11lg",scan_xmax[i]);
  148.         sprintf(string2,"max [%d]:",i);
  149.         scan_xmax_item[i]=panel_create_item(scan_panel,PANEL_TEXT,
  150.             PANEL_LABEL_X,  ATTR_COL(24),
  151.             PANEL_VALUE,    string,
  152.             PANEL_VALUE_DISPLAY_LENGTH, 14,
  153.             PANEL_LABEL_STRING, string2,
  154.             0);
  155.     }
  156.     window_fit(scan_panel);
  157.     window_fit(scan_frame);
  158.  
  159.     if(panel_colormap_on)
  160.         init_panel_colormap((Pixwin *) window_get(scan_panel,WIN_PIXWIN),"scan_panel_cms");
  161. }
  162.